*Install if you haven't already

ssc install outreg2

*Set working directory to the location of workingdataISQfile.dta and load data

use "workingdataISQfile.dta", clear

*models

xtset ccode year

**appendix guide**

*_app1 = log money results for paper models [ISQ APP 1]
*_app2 = military aid [ISQ APP 2]
*_app3 = Fariss measure [ISQ APP 3]
*_app4 = media models [ISQ APP 4]
*_app5 = collection dummy; 1993 dummy [ISQ APP 5]
*_app6 = ordered logit [ISQ APP 6]

set more off

xtlogit f.statehi loglobbiesgov, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster replace level(95) word lab

*descriptives
summ statehi loglobbiesgov logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar lntrade dr_at_us strategic_distance ///
 lnmilaid latentmean Media_ave State if e(sample)

xtlogit f.statehi logmoneygov, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*fe logits
xtlogit f.statehi loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*marginals
margins, atmeans at(alliance=0 coldwar=1 loglobbiesgov=(-.564 2.33))


xtlogit f.statehi logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*marginals
margins, atmeans at(alliance=0 coldwar=1 logmoneygov=(5.66 14.67))

*with trade
xtlogit f.statehi loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar lntrade, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtlogit f.statehi logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar lntrade, fe
outreg2 using "App1", bdec(2) tstat tdec(2) noaster replace level(95) word lab

**with diplo representation
xtlogit f.statehi loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar dr_at_us, fe
outreg2 using "Table1", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtlogit f.statehi logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar dr_at_us, fe
outreg2 using "App1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*mil aid
xtlogit f.statehi loglobbiesgov Amnesty lnmilaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App2", bdec(2) tstat tdec(2) noaster replace level(95) word lab

xtlogit f.statehi logmoneygov Amnesty lnmilaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App2", bdec(2) tstat tdec(2) noaster append level(95) word lab

*using Fariss data on RHS
xtlogit f.statehi loglobbiesgov latentmean lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App3", bdec(2) tstat tdec(2) noaster replace level(95) word lab

xtlogit f.statehi logmoneygov latentmean lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App3", bdec(2) tstat tdec(2) noaster append level(95) word lab

*media coverage covariate
xtlogit f.statehi loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar Media_ave, fe
outreg2 using "App4", bdec(2) tstat tdec(2) noaster replace level(95) word lab

xtlogit f.statehi logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar Media_ave, fe
outreg2 using "App4", bdec(2) tstat tdec(2) noaster append level(95) word lab


***models with State as DV

*with covariates
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "Table2", bdec(2) tstat tdec(2) noaster replace level(95) word lab

*marginals
margins, atmeans at(alliance=0 coldwar=1 loglobbiesgov=(-.67 2.33))

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "Table2", bdec(2) tstat tdec(2) noaster append level(95) word lab

*marginals
margins, atmeans at(alliance=0 coldwar=1 logmoneygov=(5.42 14.45))

*with trade
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar lntrade, fe
outreg2 using "Table2", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar lntrade, fe
outreg2 using "App1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*with diplo
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar dr_at_us, fe
outreg2 using "Table2", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar dr_at_us, fe
outreg2 using "App1", bdec(2) tstat tdec(2) noaster append level(95) word lab

*mil aid
xtreg f.State loglobbiesgov Amnesty lnmilaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App2", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov Amnesty lnmilaid polity lngdp lnpcgdp alliance coldwar, fe
outreg2 using "App2", bdec(2) tstat tdec(2) noaster append level(95) word lab

*with Fariss on the RHS instead of Amnesty
xtreg f.State loglobbiesgov latentmean lneconaid polity lngdp lnpcgdp alliance coldwar , fe
outreg2 using "App3", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov latentmean lneconaid polity lngdp lnpcgdp alliance coldwar , fe
outreg2 using "App3", bdec(2) tstat tdec(2) noaster append level(95) word lab

*media coverage covariate
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar Media_ave, fe
outreg2 using "App4", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar Media_ave, fe
outreg2 using "App4", bdec(2) tstat tdec(2) noaster append level(95) word lab

*control for 92-94 data collection
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar datacollect, fe
outreg2 using "App5", bdec(2) tstat tdec(2) noaster replace level(95) word lab

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar datacollect, fe
outreg2 using "App5", bdec(2) tstat tdec(2) noaster append level(95) word lab

*pre1993 indicator
xtreg f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar pre1993, fe
outreg2 using "App5", bdec(2) tstat tdec(2) noaster append level(95) word lab

xtreg f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar pre1993, fe
outreg2 using "App5", bdec(2) tstat tdec(2) noaster append level(95) word lab

*trying ordered logit
ologit f.State loglobbiesgov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar i.ccode
outreg2 using "App6", bdec(2) tstat tdec(2) noaster replace level(95) word lab

ologit f.State logmoneygov Amnesty lneconaid polity lngdp lnpcgdp alliance coldwar i.ccode
outreg2 using "App6", bdec(2) tstat tdec(2) noaster append level(95) word lab


*try biprobit

biprobit (f.hirelobby = rivallobbiesgovzero Amnesty lngdp alliance polity lnpcgdp lneconaid strategic_distance i.ccode) ///
  (f.statehi = loglobbiesgov Amnesty polity lngdp lnpcgdp alliance coldwar lneconaid i.ccode)
outreg2 using "Table3", bdec(2) tstat tdec(2) noaster replace level(95) word lab

biprobit (f.hirelobby = rivallobbiesgovzero Amnesty lngdp alliance polity lnpcgdp lneconaid i.ccode) ///
  (f.statehi = loglobbiesgov Amnesty polity lngdp lnpcgdp alliance coldwar lneconaid i.ccode)
outreg2 using "Table3", bdec(2) tstat tdec(2) noaster append level(95) word lab
